<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>计算阶乘</title>
	</head>
	<body>
		<label>请输入N:</label>
		<input type="tel"  id="jn"/>
		<input type="button" value="确定" onclick="jn()" />
		<h1>结果是：</h1>
		<h1 id="result"></h1>
		<script type="text/javascript">
			function jn(){
				var n=document.getElementById("jn").value;
				
				var s=1,i=1;
				while(i<=n){
					s=s*i;
					i++;
				}
				
				document.getElementById("result").innerHTML=s;
			}
		</script>
	</body>
</html>
